package org.afs.gescol.gwt.server.service;

import java.util.ArrayList;
import java.util.List;

import org.afs.gescol.gwt.client.service.GetServicesGwt;
import org.afs.gescol.gwt.shared.GlobalConstantesModel;
import org.scub.foundation.framework.gwt.module.client.exception.GwtRunTimeExceptionGwt;
import org.scub.foundation.framework.gwt.module.shared.IdLabelModel;

/**
 * GetServicesGwt implementation.
 * @autor Kobla GBENYO (kobla.gbenyo@gmail.com)
 */
public final class GetServicesGwtImpl implements GetServicesGwt {

    @Override
    public List<IdLabelModel> getClassByName(String name) {
        final List<IdLabelModel> res = new ArrayList<IdLabelModel>();
        res.add(new IdLabelModel(1l, "6ème"));
        res.add(new IdLabelModel(2l, "5ème"));
        return res;
    }

    @Override
    public List<IdLabelModel> getCycleByName(String name) {
        final List<IdLabelModel> res = new ArrayList<IdLabelModel>();
        res.add(new IdLabelModel(1l, "Maternelle"));
        res.add(new IdLabelModel(2l, "Primaire"));
        res.add(new IdLabelModel(3l, "Collège"));
        res.add(new IdLabelModel(4l, "Lycée"));
        return res;
    }

    @Override
    public List<IdLabelModel> getAnneeByName(String name) {
        final List<IdLabelModel> res = new ArrayList<IdLabelModel>();
        res.add(new IdLabelModel(1l, "2011-2012"));
        res.add(new IdLabelModel(2l, "2012-2013"));
        res.add(new IdLabelModel(3l, "2013-2014"));
        return res;
    }

    @Override
    public List<IdLabelModel> getPeriodeByName(String name) {
        final List<IdLabelModel> res = new ArrayList<IdLabelModel>();
        res.add(new IdLabelModel(1l, "1er Trimestre"));
        res.add(new IdLabelModel(2l, "2ème Trimestre"));
        res.add(new IdLabelModel(3l, "3ème Trimestre"));
        res.add(new IdLabelModel(4l, "1er Semestre"));
        res.add(new IdLabelModel(5l, "2ème Semestre"));
        return res;
    }

    @Override
    public List<IdLabelModel> getCycleByUser(Long userId) {
        final List<IdLabelModel> res = new ArrayList<IdLabelModel>();
        res.add(new IdLabelModel(3l, "Collège"));
        return res;
    }

    @Override
    public List<IdLabelModel> getPeriodeByAnnee(Long anneeId) {
        final List<IdLabelModel> res = new ArrayList<IdLabelModel>();
        res.add(new IdLabelModel(1l, "1er Trimestre"));
        res.add(new IdLabelModel(2l, "2ème Trimestre"));
        res.add(new IdLabelModel(3l, "3ème Trimestre"));
        return res;
    }

    @Override
    public GlobalConstantesModel getGlobalConstantesModel() {
        final GlobalConstantesModel constantes = new GlobalConstantesModel();
        constantes.setLoggedUser(new IdLabelModel(1l, "Test User"));
        constantes.setOpenedCycle(new IdLabelModel(1l, "Maternelle"));
        constantes.setOpenedYear(new IdLabelModel(2l, "2012-2013"));
        constantes.setOpenedPeriod(new IdLabelModel(3l, "3ème Trimestre"));
        constantes.setDefaultClass(new IdLabelModel(1l, "6ème"));
        constantes.setTypePere(new IdLabelModel(1l, "Père"));
        constantes.setTypeMere(new IdLabelModel(2l, "Mère"));
        constantes.setTypeTuteur(new IdLabelModel(3l, "Tuteur"));
        constantes.setDevise(new IdLabelModel(1l, "F CFA"));
        return constantes;
    }

    @Override
    public List<IdLabelModel> getGenreByTypePersonne(Long type, String start) throws GwtRunTimeExceptionGwt {
        final List<IdLabelModel> res = new ArrayList<IdLabelModel>();
        if (type.equals(1l)) {
            res.add(new IdLabelModel(1l, "Masculin"));
            res.add(new IdLabelModel(2l, "Féminin"));
        } else {
            res.add(new IdLabelModel(1l, "Monsieur"));
            res.add(new IdLabelModel(2l, "Madame"));
            res.add(new IdLabelModel(3l, "Mademoiselle"));
        }
        return res;
    }

    @Override
    public List<IdLabelModel> getOuiNon(String start) throws GwtRunTimeExceptionGwt {
        final List<IdLabelModel> res = new ArrayList<IdLabelModel>();
        res.add(new IdLabelModel(1l, "Oui"));
        res.add(new IdLabelModel(2l, "Non"));
        return res;
    }

    @Override
    public List<IdLabelModel> getStatutByName(String startName) throws GwtRunTimeExceptionGwt {
        final List<IdLabelModel> res = new ArrayList<IdLabelModel>();
        res.add(new IdLabelModel(1l, "Ancien"));
        res.add(new IdLabelModel(2l, "Nouveau"));
        return res;
    }

}